package com.tzl.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

@TableName(value = "tb_user")
@Data
public class User implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String username; // 用户名
    private String password; // 密码
    private String phone; // 电话
    private String email; // 邮箱
    private Date created; // 创建时间
    private Date updated; // 更新时间
    private String sourceType; // 来源类型
    private String nickName; // 昵称
    private String name; // 姓名
    private String status; // 状态
    private String headPic; // 头像
    private String qq; // QQ号
    private Integer accountBalance; // 账户余额
    private String isMobileCheck; // 是否已验证手机号
    private String isEmailCheck; // 是否已验证邮箱
    private String sex; // 性别
    private Integer userLevel; // 用户级别
    private Integer points; // 积分
    private Integer experienceValue; // 经验值
    private Date birthday; // 生日
    private Date lastLoginTime; // 上次登录时间
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    //比较两个User对象是否相等
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
                // 其他字段...
                && (this.getLastLoginTime() == null ? other.getLastLoginTime() == null : this.getLastLoginTime().equals(other.getLastLoginTime()));
    }
    //计算User对象的哈希值
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        // 其他字段...
        result = prime * result + ((getLastLoginTime() == null) ? 0 : getLastLoginTime().hashCode());
        return result;
    }
    //返回User对象的详细信息
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", username=").append(username);
        sb.append(", password=").append(password);
        // 其他字段...
        sb.append(", lastLoginTime=").append(lastLoginTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
